import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ytbusiness/utils/helper.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';


//聊天消息
class Message extends StatefulWidget {
  @override
  _MessageState createState() => _MessageState();
}

class _MessageState extends State<Message> {
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        shrinkWrap: true,
        itemCount: 10,
        itemBuilder: (context,index){
      return GestureDetector(
        behavior: HitTestBehavior.opaque,
          onTap: (){
            urlPush(context, "yuntu://chat_room?title=我们在中场相遇");
          },
          child: _messageItem());
    });
  }

  Widget _messageItem() {
    return Container(
      color: Color(0xffFFFFFF),
      padding: EdgeInsets.only(top: setWidth(11),left: setWidth(15),right: setWidth(15),bottom: setWidth(15)),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            height: setWidth(54),
            width: setWidth(54),
            decoration: BoxDecoration(
                image: DecorationImage(
                  image: AssetImage("assets/images/touxiang.png"),fit: BoxFit.cover,
                ),
              borderRadius: BorderRadius.circular(30)
            ),
          ),
          SizedBox(
            width: setWidth(11),
          ),
          Expanded(child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Expanded(
                    child: Container(
                      child:Text("我们在中场相遇",style: TextStyle(color: Color(0xff323232),fontSize: setSp(17)),) ,
                    ),
                  ),
                  Container(
                    child:Text("上午10:10",style: TextStyle(color: Color(0xff989898),fontSize: setSp(14)),) ,
                  )
                ],
              ),
              SizedBox(
                height: setWidth(10),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Expanded(
                    child: Container(
                      child:Text("好的呀可以，非常乐意呢是的呢好的，非常好的呀可以，非常乐意呢是的呢好的，非常",
                        style: TextStyle(color: Color(0xff989898),fontSize: setSp(14)),maxLines: 1,overflow: TextOverflow.ellipsis,) ,
                    ),
                  ),
                  SizedBox(
                    width: setWidth(10),
                  ),
                  Container(
                    decoration: BoxDecoration(
                      color: Color(0xffFA453B),
                      borderRadius: BorderRadius.circular(30)
                    ),
                    padding: EdgeInsets.only(left: setWidth(7),right: setWidth(7)),
                    child:Container(
                      alignment: Alignment.center,
                      height: setWidth(20),
                      child: Text("9",
                          style: TextStyle(color: Color(0xffFFFFFF),fontSize: setSp(12))),
                    ),
                  ),
                ],
              )
            ],
          ))
        ],
      ),

    );
  }
}
